import { myRequest } from './http.js'
let path = 'api/services/app/'

const api = {
	// 微信小程序登陆接口
	async loginWithWechatCodeAsync(data, callback) {
		let res = await myRequest({ url: path + 'User/LoginByApplet', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取用户信息接口
	async getUserInfo(data, callback) {
		let res = await myRequest({ url: path + 'User/GetUserInfo', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取轮播图
	async getBannerList(data, callback) {
		let res = await myRequest({ url: path + 'Banner/GetBannerList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取我的宠物
	async getPetList(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetPetList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 通过code获取二级code
	async getDictionaryArrayByCode(data, callback) {
		let res = await myRequest({ url: path + 'Dictionary/GetDictionaryArrayByCode', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 添加宠物
	async savePetPutOnRecord(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SavePetPutOnRecord', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 在线预约
	async saveOnlineBooking(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SaveOnlineBooking', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取我的预约列表
	async getMyBookingPage(data, callback) {
		let {pageIndex, pageSize} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Hospital/GetMyBookingPage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 获取我的挂号列表
	async getUserAppointmentRecord(data, callback) {
		let {pageIndex, pageSize} = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Hospital/GetUserAppointmentRecord', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 获取预约服务类型
	async getDictionaryListByCode(data, callback) {
		let res = await myRequest({ url: path + 'Dictionary/GetDictionaryListByCode', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取可挂号医生
	async getOnLineDoctorList(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetOnLineDoctorList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取可挂号时段
	async getAppointmentByDoctor(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetAppointmentByDoctor', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 挂号 
	async saveOnlineAppointment(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SaveOnlineAppointment', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	
	// 获取宠物动态
	async getPetNewsList(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetPetNewsList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 根据code获取文章列表
	async getArticlePage(data, callback) {
		let {pageIndex, pageSize, typeCode} = data
		let data2 = { typeCode, SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Article/GetArticlePage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	
	// 根据code获取方舟故事
	async getArticlePageByCode(data, callback) {
		let {pageIndex, pageSize, typeCode} = data
		let data2 = { typeCode, SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Article/GetArticlePageByCode', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 根据id获取详情
	async getArtDetails(data, callback) {
		let res = await myRequest({ url: path + 'Article/GetArtDetails', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 根据code获取文章详情
	async getArtDetailsByCode(data, callback) {
		let res = await myRequest({ url: path + 'Article/GetArtDetailsByCode', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 保存问诊信息
	async saveOnlineConsultation(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SaveOnlineConsultation', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取我的问诊列表
	async getMyOnlineConsultationPage(data, callback) {
		let { pageIndex, pageSize, state } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize, state }
		let res = await myRequest({ url: path + 'Hospital/GetMyOnlineConsultationPage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 获取问诊详情
	async getMyOnlineConsultationDetail(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetMyOnlineConsultationDetail', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 保存医生回答
	async saveDoctorAnswer(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SaveDoctorAnswer', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 保存宠物办证信息
	async saveAccreditation(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SaveAccreditation', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取公告
	async getNoticePages(data, callback) {
		let { pageIndex, pageSize } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Message/GetNoticePages', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 获取成长记录
	async getMyGrowthRecord(data, callback) {
		let { pageIndex, pageSize } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Article/GetMyGrowthRecord', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 保存成长记录
	async saveGrowthRecord(data, callback) {
		let res = await myRequest({ url: path + 'Article/SaveGrowthRecord', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 删除成长记录
	async deleteMyGrowthRecord(data, callback) {
		let res = await myRequest({ url: path + 'Article/DeleteMyGrowthRecord', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取成长记录详情
	async getGrowthRecordDetail(data, callback) {
		let res = await myRequest({ url: path + 'Article/GetGrowthRecordDetail', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 保存意见反馈
	async saveMessage(data, callback) {
		let res = await myRequest({ url: path + 'Message/SaveMessage', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 保存意见反馈
	async getPhoneNumberByApplet(data, callback) {
		let res = await myRequest({ url: path + 'User/GetPhoneNumberByApplet', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	async saveUserNote(data, callback) {
		let res = await myRequest({ url: path + 'Article/SaveUserNote', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	async saveNoteReply(data, callback) {
		let res = await myRequest({ url: path + 'Article/SaveNoteReply', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 点赞
	async saveUserStar(data, callback) {
		let res = await myRequest({ url: path + 'Article/SaveUserStar', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	async getNotePage(data, callback) {
		let { pageIndex, pageSize } = data
		let data2 = { SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Article/GetNotePage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	async getNoteReplyList(data, callback) {
		let res = await myRequest({ url: path + 'Article/GetNoteReplyList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	async deleteNote(data, callback) {
		let res = await myRequest({ url: path + 'Article/DeleteNote', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	async deleteNoteReply(data, callback) {
		let res = await myRequest({ url: path + 'Article/DeleteNoteReply', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取病历本
	async getPetMedicalRecordList(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetPetMedicalRecordList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 获取办证列表
	async getUserAccreditationList(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/GetUserAccreditationList', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 医生获取所有宠物列表
	async getAllPetList(data, callback) {
		let {pageIndex, pageSize, keyword} = data
		let data2 = { keyWord: keyword, SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Hospital/GetAllPetList', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 医生保存宠物动态
	async savePetNews(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SavePetNews', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 更改预约状态
	async setOnlineBookingState(data, callback) {
		let res = await myRequest({ url: path + 'Hospital/SetOnlineBookingState', method: 'POST', data: data || '' })
		callback && callback(res)
	},
	
	// 医生获取所有预约列表
	async getAllBookingPage(data, callback) {
		let {pageIndex, pageSize, state} = data
		let data2 = {state, SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Hospital/GetAllBookingPage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
	
	// 医生获取所有问诊列表
	async getAllOnlineConsultationPage(data, callback) {
		let {pageIndex, pageSize, state} = data
		let data2 = { state, SkipCount: (pageIndex - 1) * pageSize, MaxResultCount: pageSize }
		let res = await myRequest({ url: path + 'Hospital/GetAllOnlineConsultationPage', method: 'POST', data: data2 || '' })
		callback && callback(res)
	},
}

export default api